package cn.iocoder.yudao.module.fengdong.smartelderly.dal.mysql.complaint;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.fengdong.smartelderly.dal.dataobject.complaint.ComplaintDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.fengdong.smartelderly.controller.admin.complaint.vo.*;

/**
 * 投诉管理 Mapper
 *
 * @author 沣东养老院管理员
 */
@Mapper
public interface ComplaintMapper extends BaseMapperX<ComplaintDO> {

    default PageResult<ComplaintDO> selectPage(ComplaintPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ComplaintDO>()
                .eqIfPresent(ComplaintDO::getClassify, reqVO.getClassify())
                .eqIfPresent(ComplaintDO::getType, reqVO.getType())
                .eqIfPresent(ComplaintDO::getDetails, reqVO.getDetails())
                .eqIfPresent(ComplaintDO::getComplaintImages, reqVO.getComplaintImages())
                .eqIfPresent(ComplaintDO::getDisposeDetails, reqVO.getDisposeDetails())
                .eqIfPresent(ComplaintDO::getDisposeImages, reqVO.getDisposeImages())
                .betweenIfPresent(ComplaintDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ComplaintDO::getContactInformation, reqVO.getContactInformation())
                .eqIfPresent(ComplaintDO::getSchedule, reqVO.getSchedule())
                .orderByDesc(ComplaintDO::getId));
    }

    default List<ComplaintDO> selectList(ComplaintExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ComplaintDO>()
                .eqIfPresent(ComplaintDO::getClassify, reqVO.getClassify())
                .eqIfPresent(ComplaintDO::getType, reqVO.getType())
                .eqIfPresent(ComplaintDO::getDetails, reqVO.getDetails())
                .eqIfPresent(ComplaintDO::getComplaintImages, reqVO.getComplaintImages())
                .eqIfPresent(ComplaintDO::getDisposeDetails, reqVO.getDisposeDetails())
                .eqIfPresent(ComplaintDO::getDisposeImages, reqVO.getDisposeImages())
                .betweenIfPresent(ComplaintDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ComplaintDO::getContactInformation, reqVO.getContactInformation())
                .eqIfPresent(ComplaintDO::getSchedule, reqVO.getSchedule())
                .orderByDesc(ComplaintDO::getId));
    }

}
